<a id="comment-<%= hashid(@comment) %>" class="anchor"></a>
<div class="comment_wrapper">
  <article class="comment js-comment <%= modifier_classes(@item, @comment) %>" data-id="<%= hashid(@comment) %>">
    <button class="comment-toggle js-comment-collapse"></button>
    <div class="comment-connector js-comment-collapse"></div>

    <header class="comment-header">
    <%= if @comment.author do %>
      <button class="comment-author has-tooltip">
        <%= SharedHelpers.lazy_image(PersonView.avatar_url(@comment.author), @comment.author.name, width: 20, height: 20, class: "comment-author-image") %>
        <p class="comment-author-name"><%= @comment.author.handle %></p>
      </button>
      <%= render(PersonView, "_tooltip.html", Map.merge(assigns, %{person: @comment.author})) %>
    <% else %>
      <span class="comment-author">[deleted]</span>
    <% end %>
      <p class="comment-actions">
        <%= link(to: permalink_path(@comment), class: "js-permalink") do %>
          <%= TimeView.ts(@comment.inserted_at, "relativeShort") %> ago
        <% end %>
        <!--<a href="#TODO-edit" title="">edit</a>-->
      </p>
    </header>

    <div class="comment-body richtext richtext--comment">
      <%= @comment.content |> transformed_content() |> raw() %>
    </div>

    <footer class="comment-footer">
      <p class="comment-actions">
        <%= if Policies.NewsItemComment.update(@current_user, @comment) do %>
          <a href="javascript:void(0)" title="Edit your comment" class="js-comment-edit">edit</a>
        <% end %>

        <a href="javascript:void(0)" title="Reply to this comment" class="js-comment-reply">reply</a>
      </p>
    </footer>

    <%= if @current_user, do: render("_reply_form.html", Map.merge(assigns, %{parent: @comment})) %>
    <%= if Policies.NewsItemComment.update(@current_user, @comment), do: render("_edit_form.html", Map.merge(assigns, %{comment: @comment})) %>

    <section class="comment-replies">
      <%= render_many(@comment.children, __MODULE__, "show.html", Map.merge(assigns, %{as: :comment})) %>
    </section>
  </article>
</div>
